package com.touch.jgloo;

import javax.media.opengl.GLAutoDrawable;
public class JGLFPSLock extends JGLFPSCounter
{		
	public JGLFPSLock()
	{
		super();
		this.setInterval(0.5f);
	}
	public JGLFPSLock(byte status)
	{
		super(status);
		this.setInterval(0.5f);
	}
	@Override
	public void display(GLAutoDrawable arg0) 
	{	
		super.display(arg0);
		if((this.status & ENABLE_FPS_LOCK) == 0)
			return;
		try
		{
			if(this.getFPS() < 60)
				return;
			long timeToWait = (int)this.getFPS() - 60;
			if(timeToWait > 0)
				Thread.sleep(timeToWait);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		
	}
}
